package com.tengju.user.infrastructure.repository.convert;

import com.tengju.user.domain.model.protocol.UserProtocol;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.UserProtocolDO;

public class UserProtocolConfirmConvert {

    public static UserProtocolDO convertToDO(UserProtocol userProtocol) {
        if (userProtocol == null) {
            return null;
        }
        UserProtocolDO userProtocolDO = new UserProtocolDO();
        userProtocolDO.setUserId(userProtocol.getUserId().getValue());
        userProtocolDO.setProtocolType(userProtocol.getProtocolType().getId());
        userProtocolDO.setProtocolVersion(userProtocol.getProtocolVersion().getProtocolVersion());
        userProtocolDO.setProtocolVersion(userProtocol.getProtocolVersion().getProtocolVersion());
        userProtocolDO.setAgreeTime(userProtocol.getConfirmTime());

        return userProtocolDO;
    }
}
